package View;

import java.awt.Dimension;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;

import Model.Utilisateur;

public class PanneauUtilisateur extends JPanel{
	private static final long serialVersionUID = 1L;

	public PanneauUtilisateur(Utilisateur user) {
		
		String infoUtil = "<html><p><table border=\"1\" bgcolor=\"white\">";
		
		infoUtil += getUserHTMLLine("Nom", user.getNom());
		infoUtil += getUserHTMLLine("Login", user.getLogin());
		infoUtil += getUserHTMLLine("Privilège", user.getNiveauPrivilege().toString());
		infoUtil += getUserHTMLLine("Login supérieur", user.getLoginSuperieurHierarchique());
		infoUtil += "</table></p></html>";
		
		
		JLabel labelInfoUtil = new JLabel(infoUtil);
		
		this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
		this.add(labelInfoUtil);
		
		this.setSize(new Dimension(200, 200));
	}
	
	private String getUserHTMLLine(String col1, String col2) {
		return "<tr><td>" + col1 + "</td><td>" + col2 + "</td></tr>";
	}
}
